<%-- 
    Document   : showAdmin
    Created on : Aug 20, 2012, 1:46:16 PM
    Author     : HungDQ
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<div class="section table_section">
    <!--[if !IE]>start title wrapper<![endif]-->
    <div class="title_wrapper">
        <h2>Management Account Role</h2>
        <span class="title_wrapper_left"></span>
        <span class="title_wrapper_right"></span>
    </div>
    <!--[if !IE]>end title wrapper<![endif]-->
    <!--[if !IE]>start section content<![endif]-->
    <div class="section_content">
        <!--[if !IE]>start section content top<![endif]-->
        <div class="sct">
            <div class="sct_left">
                <div class="sct_right">
                    <div class="sct_left">
                        <div class="sct_right">
                            <div  id="product_list">
                            <!--[if !IE]>start table_wrapper<![endif]-->
                                <div class="table_wrapper">
                                    <div class="table_wrapper_inner">
                                        <%
                                        Object message = request.getSession().getAttribute("MESS");
                                        if(message != null && !message.equals(""))
                                        {
                                            out.println("<script>alert(\""+message.toString()+"\");</script>");
                                            request.getSession().removeAttribute("MESS");
                                        }
                                        %>

                                        <%
                                        Object objAppCon = application.getAttribute("APP_CONN");
                                        java.util.ArrayList<org.nvdung.bean.Role> al;
                                        if(objAppCon != null)
                                        {
                                            java.sql.Connection connection = (java.sql.Connection)objAppCon;
                                            org.nvdung.db.SqlRole sqlRole = new org.nvdung.db.SqlRole(connection);
                                            al = sqlRole.getAllRole();
                                            if(al.size() > 0)
                                            {
                                        %>
                                        <table cellpadding="0" cellspacing="0" width="100%" align="center">
                                            <tbody>
                                             <tr>
                                                <th style="width: 15%; text-align: center;" align="center">ID</th>
                                                <th style="width: 70%; text-align: center;" align="center">Role Name</th>
                                                <th style="width: 15%; text-align: center;" align="center">Actions</th>
                                            </tr>
                                            <%
                                            for(int i=0;i<al.size();i++)
                                            {
                                                org.nvdung.bean.Role role = al.get(i);
                                            %>

                                            <tr style="height: 35px;" class="<% if(i%2==0) out.println("second"); else out.println("first"); %>">
                                                <td style="text-align: center;"><%=role.getRoleID() %></td>
                                                <td><a href="#" class="product_name"><%=role.getRoleName() %></a></td>
                                                <td style="text-align: center;">
                                                    <div class="actions_menu">
                                                        <ul>
                                                            <li><a class="edit" href="?option=role&action=edit&id=<%=role.getRoleID() %>">Edit</a></li>
                                                            <li><a class="delete" onclick="return confirm('Do you want delete role with id = <%=role.getRoleID() %> ?');" href="javascript: gotoDelete('<%=role.getRoleID()%>');">Delete</a></li>
                                                        </ul>
                                                    </div>
                                                </td>
                                            </tr>
                                            <%
                                            }
                                            %>
                                            </tbody>
                                        </table>
                                        <%
                                        }
                                    }
                                    %>
                                        <div style="height: 20px;"></div>
                                        <div class="table_menu">
                                            <ul class="right">
                                                <li><a href="?option=member" class="button check_all"><span><span>Manager Members</span></span></a></li>
                                                <li><a href="?option=role&action=add" class="button add_new"><span><span>ADD NEW ROLE</span></span></a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            <!--[if !IE]>end table_wrapper<![endif]-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--[if !IE]>end section content top<![endif]-->
        <!--[if !IE]>start section content bottom<![endif]-->
        <span class="scb"><span class="scb_left"></span><span class="scb_right"></span></span>
        <!--[if !IE]>end section content bottom<![endif]-->
    </div>
    <!--[if !IE]>end section content<![endif]-->
</div>
<form name="frmDelete" method="get" action="../nvdung/role/delete">
    <input type="hidden" name="id" value="" />
</form>
<script>
    function gotoDelete(deleteValue) {
        document.frmDelete.id.value = deleteValue;
        document.frmDelete.submit();
    }
</script>